<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:rg="http://www.ruijie.com.cn/faces/ui"
	xmlns:c="http://java.sun.com/jstl/core"
	template="/layout/contentLayout.xhtml">	

    <ui:define name="content">
    	<rg:titlePanel id="memberBaseInfo"  headerTitle="基本信息">
    		<ui:define name="headerActions">
				<h:outputLink value="javascript:void(-1);"
					onclick="UI.instance.showDialog({id:'update', src:'/luyuan/member/updateUser.jsf?memberId=#{memberAction.memberModel.id}'});">修改</h:outputLink>
			</ui:define>
			<rg:fieldSet column="double">
                <rg:outputText id="name" required="true" label="姓名" value="#{memberAction.memberModel.name}" />
                <rg:outputText id="memNumber" label="#{messages.luyuan_member_memNumber}" value="#{memberAction.memberModel.account.username}"/>
                <rg:outputText id="gender" required="true" label="姓别" value="#{memberAction.memberModel.gender}" 
                   	converter="#{genderConverter}"/>
                <rg:outputText id="birthDate"  label="生日" value="#{memberAction.memberModel.birthDate}" converter="#{dateConverter}" datePattern="yyyy-MM-dd"/>
				<rg:outputText id="mobile" label="#{messages.luyuan_member_mobile}" value="#{memberAction.memberModel.mobile}" />
				<rg:outputText id="qq" label="QQ" value="#{memberAction.memberModel.qq}" />
                <rg:outputText id="email" label="电子邮件" value="#{memberAction.memberModel.email}" singleLine="true"/>
				<rg:outputText id="memberLevel"
					value="#{memberAction.memberModel.memberIntegral.memberLevel}" converter="#{memberLevelConverter}" label="会员级别" />
				<rg:outputText id="loyalty"
					value="#{memberAction.memberModel.loyalty}" converter="#{memberLoyaltyConverter}" label="忠诚度" />
				<rg:outputText id="liveness"
					value="#{memberAction.memberModel.liveness}" converter="#{memberLivenessConverter}" label="活跃状态" />
				<rg:outputText id="memberGroups"
					value="#{memberAction.memberModel.memberGroups}" converter="#{memberGroupsConverter}" label="会员分类" />
				<rg:outputText id="currentIntegral"
					value="#{memberAction.memberModel.memberIntegral.currentIntegral}" label="可用积分" />
				<rg:outputText id="coupons"
					value="#{memberAction.memberModel.coupons}" converter="#{memberCouponsConverter}" label="可用A/B卷" />
				<rg:outputText id="discount"
					value="#{memberAction.memberModel.memberIntegral.discount * 10}折" label="享受折扣"  singleLine="true"/>
				<rg:outputText id="nativePlace" label="籍贯" value="#{memberAction.memberModel.nativePlace}"/>
                <rg:outputText id="address" label="#{messages.luyuan_member_addresses}" 
                   	value="#{memberAction.memberModel.address.getAddress()}" singleLine="true"/>
                <rg:outputText id="postCode" label="#{messages.luyuan_member_postCode}"
                   	value="#{memberAction.memberModel.address.postCode}" singleLine="true"/>
			</rg:fieldSet>
    	</rg:titlePanel>
    	
    	<rg:titlePanel id="memberHeathInfo"  headerTitle="#{questionValueAction.question.questionName}">
    		<ui:define name="headerActions">
  	            <h:form>
  	            	<table>
  	            		<tr>
  	            			<td>
					<rg:selectOne id="question" value="#{questionValueAction.question}"
						itemsProvider="#{questionProvider}"
						converter="#{questionConverter}" enableEmpty="false">
						<a:support event="onchange" 
							actionListener="#{questionValueAction.clearQuestionValues()}" reRender="memberHeathInfo_titlePanel" oncomplete="UI.instance.cssFix();"/>
					</rg:selectOne>
  	            			</td>
  	            			<td>
           			<h:outputLink value="javascript:void(-1);"
                         onclick="UI.instance.showDialog({id:'updateQuestion', src:'/luyuan/question/updateQuestionValue.jsf?memberId=#{memberAction.memberModel.id}&amp;questionId=#{questionValueAction.question.id}'});">更新申请表</h:outputLink>
  	            			</td>
  	            		</tr>
  	            	</table>
				</h:form>
			</ui:define>
			<rg:fieldSet id="questionValues" column="double">
				<ui:repeat var="questionValue" value="#{questionValueAction.getQuestionValues()}">
	                <rg:outputText label="#{questionValue.questionExtend.item}"
	                   	value="#{questionValue.extendValue}" singleLine="#{questionValue.questionExtend.itemType == 'BIGTEXTAREA' or questionValue.questionExtend.itemType == 'TEXTAREA'}"/>
				</ui:repeat>
			</rg:fieldSet>
		</rg:titlePanel>
    	
    	<rg:titlePanel id="memberOrderInfo"  headerTitle="购买记录">
  	            <h:form>
                  <rg:table id="orderTable"
                        value="#{orderMemberAction.orderTableModel}" var="item">
						<rg:column property="id" title="订单号" />
						<rg:column property="customer.name" title="会员" />
						<rg:column property="saleman.userName" title="制单人" />
						<rg:column property="amount" title="成交额" />
						<rg:column property="orderType" title="订单类型"
							converter="#{orderTypeConverter}" />
						<rg:column property="orderStatus" title="订单状态"
							converter="#{orderStatusConverter}" />
						<rg:column property="createTime" title="制单时间" 
							datePattern="yyyy-MM-dd HH:mm" converter="#{dateConverter}" />
                        <rg:column cellType="oper"
                                title="#{messages.crud_tbl_operate_label}" width="220">
                                <ul class="links">
                                <li>
                                        <a href="#{ctx}/luyuan/sale/orderViewForMember.jsf?id=#{item.id}" target="orderView">详细订单</a>
                                </li>
                                </ul>
                 </rg:column>
                   </rg:table>
            </h:form>
        </rg:titlePanel>
        
    	<rg:titlePanel id="memberCallBackInfo"  headerTitle="回访记录">
    		<ui:define name="headerActions">
				<h:outputLink value="javascript:void(-1);"
                        onclick="UI.instance.showDialog({id:'detail', src:'/luyuan/member/addCallBackRecord.jsf?memberId=#{memberAction.memberModel.id}'});">会员回访</h:outputLink>
               <h:outputLink value="javascript:void(-1);"
                             onclick="UI.instance.showDialog({id:'add', src:'/luyuan/member/sendSms.jsf?memberId=#{memberAction.memberModel.id}'});">发送短信</h:outputLink>
			</ui:define>
        			<h:form>
					<rg:table id="callBackRecordTable"
						value="#{callbackRecordAction.tableModel}" var="entity"
						columnConfigurable="disable">
						<rg:column property="member.name" sortable="false"
							title="#{messages.luyuan_member_name}" />
						<rg:column property="content" sortable="false"
							title="#{messages.luyuan_callBackRecord_content}" />
							<rg:column property="recordTime" sortable="false"
                            title="#{messages.luyuan_callBackRecord_recordTime}" />
					</rg:table>
			</h:form>
		</rg:titlePanel>
		
		
		<a:form>
			<a:jsFunction name="reRenderMemberBaseInfo" actionListener="#{memberAction.reloadMember()}" reRender="memberBaseInfo_titlePanel" oncomplete="UI.instance.cssFix();"/>
			<a:jsFunction name="reRenderMemberHeathInfo" actionListener="#{questionValueAction.clearQuestionValues()}" reRender="memberHeathInfo_titlePanel" oncomplete="UI.instance.cssFix();"/>
			<a:jsFunction name="reRenderCallBackRecordTable" reRender="callBackRecordTable"/>
		</a:form>
    </ui:define>
</ui:composition>
